package com.vinann.controller;

import javax.servlet.http.HttpServletRequest;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.core.Authentication;
import org.springframework.social.connect.web.ProviderSignInUtils;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.context.request.ServletWebRequest;

import com.vinann.security.app.social.AppSingUpUtils;

@RestController
public class UserController {

	
	@Autowired
	private ProviderSignInUtils providerSignInUtils ;
	
	@Autowired
	private AppSingUpUtils appSingUpUtils;
	
	
	@GetMapping("/me")
	public Authentication me(Authentication authentication){
		return authentication;
	}
	
	@PostMapping("/user/regist")
	public void regist(HttpServletRequest request){
		//providerSignInUtils.doPostSignUp("haha", new ServletWebRequest(request));
		appSingUpUtils.doPostSignUp(new ServletWebRequest(request), "haha");
	}
}
